<?php

// ConfirmForm receives the form data from the
// DuplicatesSearch results view and generates 
// a form to make the user confirm.

class ConfirmForm extends Zend_Form
{
    public function __construct($resultsFormData)
    {  
        parent::__construct(null);
        $this->setName('delete');
        
        $confirmed = new Zend_Form_Element_Hidden('confirmed');
        $confirmed->setValue('true');
        
        $count = 1;
        foreach ($resultsFormData as $key=>$value)
        {
            if('on' == $value){
                $el = new Zend_Form_Element_Hidden('delete' . $count++);
                $el->setValue($key);
                $this->addElement($el, $key);
            }
        }
 
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');
        $submit->setLabel('Go ahead and delete them!');
        $this->addElements(array($confirmed, $submit));
    }
}
?>